﻿<!-- 
// (c) Copyright Webber-Cross Software Ltd.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->
    
    <UserControl x:Class="WebberCross.BdcModelBuilder.TabControls.ModelsTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             >
      
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="105"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="*"/>

        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Border BorderBrush="DarkGray" BorderThickness="1" />

        <!-- ModelContainer binding -->
        <Grid x:Name="gridModelContainer" >
            <Grid.RowDefinitions>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="35" />
            </Grid.ColumnDefinitions>
                
            <Label>Output Path:</Label>
            <Label Grid.Row="1">Models:</Label>
            <Label Grid.Row="2">Target Namespace:</Label>

            <TextBox x:Name="tbOpPath" Grid.Column="1" Margin="3" Text="{Binding Path=ModelContainer.OpPath}" IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
            <ComboBox x:Name="cboModels" Grid.Row="1" Grid.Column="1" Margin="3" Grid.ColumnSpan="2" ItemsSource="{Binding Path=ModelContainer.Models}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding Path=ModelContainer.CurrentID}" IsEnabled="True" />
            <TextBox x:Name="tbTargetNS" Grid.Row="2" Grid.Column="1" Margin="3" Grid.ColumnSpan="2" Text="{Binding Path=ModelContainer.TargetNameSpace}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
            <Button x:Name="btnOpPath" Grid.Column="2" Content="..." Margin="3" Command="{Binding Path=MVM.OpPathBrowseFolderCommand}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
        </Grid>
                
        <!-- Current Model binding -->
        <Border  Grid.Row="2" BorderBrush="DarkGray" BorderThickness="1" />
        <Grid x:Name="gridCurrentModel" Grid.Row="2"  >
            <Grid.RowDefinitions>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="35" />
            </Grid.ColumnDefinitions>
            
            <Label >Current Model:</Label>
            <Label Grid.Row="1">Assembly Path:</Label>
            <Label Grid.Row="2">Namespace:</Label>
            <Label Grid.Row="3">Output:</Label>

            <TextBox x:Name="tbCurrentModel" Grid.Column="1" Margin="3" Grid.ColumnSpan="2" Text="{Binding Path=ModelContainer.CurrentModel.Name}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
            <TextBox x:Name="tbAssemblyPath" Grid.Row="1" Grid.Column="1" Margin="3" Text="{Binding Path=ModelContainer.CurrentModel.AssemblyPath}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
            <TextBox x:Name="tbNameSpace" Grid.Row="2" Grid.Column="1" Margin="3" Grid.ColumnSpan="2" Text="{Binding Path=ModelContainer.CurrentModel.ModelNS}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
            <CheckBox x:Name="cbOutput" Grid.Row="3" Grid.Column="1" Margin="3" VerticalAlignment="Center" IsChecked="{Binding Path=ModelContainer.CurrentModel.Output}"  IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}"  />
            <Button x:Name="btnAssemblyPath" Grid.Row="1" Grid.Column="2" Content="..." Margin="3" Command="{Binding Path=MVM.AssemblyPathOpenFileCommand}" IsEnabled="{Binding Path=ModelContainer.EditMode, Mode=OneWay}" />
        </Grid>
    </Grid>

 

</UserControl>
